package com.yiqi.lottery.feature.find.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.lottery.entity.bo.LotteryHistoryBo;
import com.yiqi.lottery.entity.bo.LotteryResultBo;
import com.yiqi.lottery.feature.find.contract.ResultContract;
import com.yiqi.lottery.feature.find.dependencies.circle.DaggerCircleModelComponent;
import com.yiqi.lottery.feature.find.dependencies.result.DaggerResultModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.FindApi;
import io.reactivex.Observable;

import javax.inject.Inject;
import java.util.List;

public class ResultModel implements ResultContract.Model {

    @Inject
    FindApi api;


    @Inject
    public ResultModel() {

        DaggerResultModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<LotteryResultBo>> getLotteryResult(int listen) {
        return api.getLotteryResult(listen).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<List<LotteryHistoryBo>> getLotteryHistory(String label) {
        return api.getLotteryHistory(label).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
